<template>
    <div>
        <heads   :showBack="showBack"  :showStatus="true"  title="扫描二维码登录"></heads>
        <msg title="即将在电脑上登录网页版"  :buttons="buttons" :icon="icon"></msg>
    </div>
</template>

<script>
    import heads from '../header';
    import { Msg } from 'vux'
    export default {
        name: "accredit",
        components: {
            Msg,
            heads
        },
        methods: {
            changeIcon () {
                var _this =this;
                this.$axios.post(this.$axios.defaults.baseURL+'barcode',{
                    barcode:this.barcode
                }).then(function (res) {
                    if(res.data.state){
                        _this.$router.push({path:'/'});
                    }else {
                       alert('登录失败')
                    }
                }).catch(function (err) {
                    console.log(err)
                })
            }
        },
        data () {
            return {
                showBack:{
                    showBack:true
                },
                icon: 'info',
                buttons: [{
                    type: 'primary',
                    text: '确认登录',
                    onClick: this.changeIcon.bind(this)
                }, {
                    type: 'default',
                    text: '关闭',
                    link: '/'
                }],
                barcode:''
            }
        },
        activated(){
          this.barcode=  this.$route.params.barcode
        }
    }
</script>

<style scoped>

</style>